<?php
	/**
	* @package ParkFind
	* @desc This is the login php script. This script is used for logging in a user. Using Session variables to determine what features to display on main screen.
	*/
	/**
	* @desc This include file will load the directory settings for the Smarty Templates
	*/
	session_start();
	
	//Smarty
	require 'includes/smarty.inc';
	$smarty->assign('title', "Login");
	$smarty->assign('user_id', $_SESSION["user_id"]);
	$smarty->assign('firstname', $_SESSION["firstname"]);
	$smarty->assign('role', $_SESSION["role"]);   
	$smarty->assign('top5', $_SESSION["top5"]);	
	$smarty->display('header.tpl');

	//Referer for go back button on receipt page
	if (isset($_SERVER["HTTP_REFERER"]))
		$_SESSION["referer"] = $_SERVER["HTTP_REFERER"];
		
	$smarty->assign('user_id', $_SESSION["user_id"]);

	if (isset($_SESSION["form"]["email"]))
		$smarty->assign('email',  $_SESSION["form"]["email"]);

	if (isset($_SESSION["errors"]["email"]))
		$smarty->assign('emailerr', $_SESSION["errors"]["email"]);

	if (isset($_SESSION["errors"]["pass"]))
		$smarty->assign('passerr', $_SESSION["errors"]["pass"]);
		 
	$smarty->display('login.tpl');
	
	unset($_SESSION["errors"]);
	unset($_SESSION["form"]);
	
	$smarty->display('footer.tpl');
	
?>
